package day14_21.day17;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        if (n == 1 || n == 2){
            System.out.println(0);
        }
        if (n % 4 == 0){
            System.out.println(3);
        }else if (n % 4 == 2){
            System.out.println(4);
        }else {
            System.out.println(2);
        }
    }
}
